<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class SellerRecordationAndTransferTaxFactory{

    public function createSplitRecordationAndTransferTaxes($propertyTransferTax, $countyPropertyTransferTax, $recordationTax,
                                                                                $extraBuyerRecordationTax, $fees,
                                                                                $payerSpecialCase) {

        // CT-8 all recording fees will be charged to the buyer unless the user selects "Seller Pays All" then you will show the fees on the seller's side.
        // To put this another way, the default will always be that the recording fees will be to shown on the buyer's side.

        $zeroRecordationTax = null;
        if ($recordationTax != null) {
            $zeroRecordationTax = new RecordationTax($recordationTax->getName(), $extraBuyerRecordationTax);
        } else {
            $zeroRecordationTax = null;
        }

        $zeroPropertyTransferTax = null;
        if ($propertyTransferTax != null) {
            $zeroPropertyTransferTax = new StatePropertyTransferTax($propertyTransferTax->getName(), 0.0);
        } else {
            $zeroPropertyTransferTax = null;
        }

        $zeroCountyPropertyTransferTax = null;
        if ($countyPropertyTransferTax != null) {
            $zeroCountyPropertyTransferTax = new CountyPropertyTransferTax($countyPropertyTransferTax->getName(), 0.0);
        } else {
            $zeroCountyPropertyTransferTax = null;
        }

        $recordationAndTransferTaxes = array();

        $zeroFees = FeeHelper::getCloneWithZeroValue($fees);

        $recordationAndTransferTaxes[] = new RecordationAndTransferTaxes(
                $zeroPropertyTransferTax, $zeroCountyPropertyTransferTax, $zeroRecordationTax,
                $zeroFees,
                EPayer::Buyer);

        $recordationAndTransferTaxes[] = new RecordationAndTransferTaxes(
                $propertyTransferTax, $countyPropertyTransferTax, $recordationTax,
                $fees,
                EPayer::Seller);

        return $recordationAndTransferTaxes;
    }
}
?>
